package com.chujian.core.entity;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chujian.framework.core.IId;
import com.chujian.framework.core.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author chujian
 * @since 2021-08-24
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("core_class")
@KeySequence("core_class_seq")
@ApiModel(value = "实体", description = "")
public class CoreClass extends BaseEntity implements IId, Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId("class_id")
    private Long classId;

    @ApiModelProperty(value = "名称")
    @TableField("class_name")
    private String className;

    @ApiModelProperty(value = "类类型")
    @TableField("class_type")
    private String classType;

    @ApiModelProperty(value = "配置")
    @TableField("cfg")
    private String cfg;


    // ++++++ 系统拓展 +++++++
    @TableField(exist = false)
    private Map<String, String> query = new HashMap<>();

    @Override
    public Long getId() {
        return this.classId;
    }

    @Override
    public void setId(Serializable id) {
        if (null != id) {
            this.classId = Long.parseLong("" + id);
        }
    }

    // ++++++ 业务拓展 +++++++
    @TableField(exist = false)
    private Object cfgObj;
}
